package com.fulu.netty.luban.onereactor;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class Client1 {
    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        InetSocketAddress inetSocketAddress = new InetSocketAddress("127.0.0.1", 1333);
        socketChannel.connect(inetSocketAddress);
        ByteBuffer buffer = ByteBuffer.allocateDirect(10);
        buffer.put("hello".getBytes());
        buffer.flip();
        int write = socketChannel.write(buffer);
        buffer.clear();
        socketChannel.read(buffer);
        buffer.flip();
        System.out.println(buffer.get());

    }
}
